package com.braveman.im.ui.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.ht.baselibs.ui.base.BaseActivity;

import com.braveman.im.R;


public class WebViewNotifyActivity extends BaseActivity {
private WebView web_view;
    private String mUrl;
    private String mCenterTitle;

    @Override
    protected boolean isStaticPage() {
        return true;
    }

    @Override
    protected void initTitleBar() {
        if (!TextUtils.isEmpty(mCenterTitle)){
            mTitleBarView.setTitleText(mCenterTitle);
        }else {
            mTitleBarView.setTitleText("钱包++");
        }
    }
    @Override
    protected void initIntentData(Intent callIntent) {
        mUrl = callIntent.getStringExtra("url");
        mCenterTitle = callIntent.getStringExtra("title");
    }

    @Override
    protected int initContentView() {
        return R.layout.activity_web_view;
    }

    @Override
    protected void initChildView() {
        web_view = (WebView) findViewById(R.id.web_view);
        WebSettings settings = web_view.getSettings();
        web_view.setVerticalScrollBarEnabled(false);
        web_view.setHorizontalScrollBarEnabled(false);
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
//        settings.setUseWideViewPort(true);
//        settings.setLoadWithOverviewMode(true);
//        mWebView.getSettings().setBlockNetworkImage(false);
        web_view.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url)
            {
//                web_view.loadUrl("http://hsy.qianbaojiajia.com/notice/detail?noticeId=49");
                return true;
            }
        });
    }


    @Override
    protected void initChildData() {
        web_view.loadUrl("www.baidu.com");

    }

    @Override
    protected void setChildViewListener() {

    }

    @Override
    protected void onResume() {
        super.onResume();
    }
}

